package cn.appsys.controller;

import cn.appsys.pojo.DevUser;
import cn.appsys.service.DevUserService;
import cn.appsys.tools.Constants;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller
public class DevUserController {
	@Resource
	DevUserService devUserService;

	@RequestMapping("devlogin.do")
	public String login(String devCode,String devPassword,HttpSession session) {
		DevUser devUser = devUserService.login(devCode, devPassword);
		if (devUser!=null) {
			session.setAttribute(Constants.DEV_USER_SESSION, devUser);
			return "redirect:tomain";
		} else {
			return "redirect:devlogin.jsp";
		}
	}
}
